package patten.xingwei.state;

import javax.xml.stream.events.Characters;

/**
 * Description：正常状态
 * Author：zwenzhi
 * Date：2023/10/26 16:48
 */
public class NormalState extends CharacterState {
    public NormalState(Character character) {
        super(character);
    }

    @Override
    void handleAttack() {
        System.out.println("正常状态,造成"+character.getAttack()+"点伤害");
    }

    @Override
    void handleDamage( int damage) {
        character.setHealth(Math.max(character.getHealth()-damage,0));
        System.out.println("正常状态,受到"+damage+"点伤害,当前生命值:"+character.getHealth());
    }

    @Override
    void handleHeal(int healing) {
        character.setHealth(Math.min(character.getHealth()+healing,character.getMaxHealth()));
        System.out.println("正常状态,恢复"+healing+"点血量,当前生命值:"+character.getHealth());
    }
}
